//
//  YZLCarCollectListCell.m
//  Car
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZLCarCollectListCell.h"
#import <UIImageView+WebCache.h>

@interface YZLCarCollectListCell ()

@property (nonatomic, strong) UIImageView *leftImage;
@property (nonatomic, strong) UILabel *name;
@property (nonatomic, strong) UILabel *price;

@end

@implementation YZLCarCollectListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.leftImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.leftImage];
        
        self.name = [[UILabel alloc] init];
        [self.contentView addSubview:self.name];
        
        self.price = [[UILabel alloc] init];
        [self.contentView addSubview:self.price];
    }
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.leftImage.frame = CGRectMake(15, 10, 90, 70);
    self.price.frame = CGRectMake(120, 50, self.contentView.frame.size.width - 150, 20);
    self.name.frame = CGRectMake(120, 20, self.contentView.frame.size.width - 130, 20);
}

- (void)setModel:(YZLCollectionModel *)model {
    
    if (_model != model) {
        _model = model;
    }
    
    self.name.text = self.model.title;
    [self.leftImage sd_setImageWithURL:[NSURL URLWithString:self.model.image]];
    self.price.text = [NSString stringWithFormat:@"厂商指导价: %@", self.model.price];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
